﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
   public  class aop
    {      
        public void test<T>(Action tbefore, Action tafter,T t) 
        {
            mys<T> myclass = new mys<T>();
            myclass.Executehello(tbefore, tafter, t);           
        }
    }

    class mys<T>:tt<T> 
    {
        public override T hello(T t)
        { 
            Console.WriteLine("mys:" + t);
            return t;
        }
    }

    interface test<T>
    {
        T hello(T t);
    }



     class tt<T>:test<T> 
    {
       public   T Executehello(Action before,Action after,T t)
        {
            before();
            T  res = hello(t);
            after();
            return res;
        }

        public virtual  T hello(T t)
        {
            Console.WriteLine(t);
            return t;
        }
    }
}
